<?

class Qi_Gdata_Picasa_Photo
{
	public function __construct($entry)
	{
		$this->entry = $entry;
		$this->attribute("id", "gphoto:id");
		$this->attribute("title", "*[name()='title']");
		$this->attribute("thumbnail", "media:group/media:thumbnail[1]", "url");
	}

	public function thumbnail($size, $crop = false)
	{
		return Qi_Gdata_Picasa_Album::thumb($this->thumbnail, $size, $crop);
	}

	private function attribute($name, $path, $atrrib = null)
	{
		$tmp = $this->entry->xpath($path);
		if ($atrrib !== null):
			$x = reset($tmp);
			$this->$name = (string)$x[$atrrib];
		else:
			$this->$name = (string)reset($tmp);
		endif;
	}
}

?>